<%@ Page Language="C#" MasterPageFile="~/Base.Master" AutoEventWireup="true" CodeBehind="CompEnrolmentType.aspx.cs" Inherits="SVAccountingWebUI.CompEnrolmentType" %>
<%@ MasterType VirtualPath="~/Base.Master" %>

<asp:Content ID="Default" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

    <asp:GridView ID="gvEnrolmentTypes" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" CellPadding="3" 
        DataKeyNames="TypeCode" DataSourceID="CompEnrolmentTypeLinqDataSource" 
        ForeColor="Black" GridLines="Vertical" BackColor="White" 
        BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px"
        onrowcancelingedit="gv_RowCancelingEdit" 
        onrowdeleting="gv_RowDeleting" 
        onrowediting="gv_RowEditing"
        >
        <Columns>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, EditDelete %>">
                 <EditItemTemplate>
                &nbsp;
                    <asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="True" 
                        CommandName="Update" ImageUrl="~/Icons/Update.png" Text="Update" />
                    /&nbsp;
                    <asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="False" 
                        CommandName="Cancel" ImageUrl="~/Icons/Cancel.png" Text="Cancel" />
                </EditItemTemplate>
                <ItemTemplate>
                &nbsp;
                    <asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="False" 
                        CommandName="Edit" ImageUrl="~/Icons/Edit.png" Text="Edit" />
                    /&nbsp;
                    <asp:ImageButton ID="DeleteButton" runat="server" CausesValidation="False" 
                        CommandName="Delete" ImageUrl="~/Icons/delete.png" Text="Delete"
                        message="<%$ Resources:Resource, DeleteConfirm %>" 
                        OnClientClick='return confirm(this.getAttribute("message"))'
                        />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="TypeCode" HeaderText="<%$ Resources:Resource, Code %>" ReadOnly="True" 
                SortExpression="TypeCode" />
            <asp:BoundField DataField="TypeName" HeaderText="<%$ Resources:Resource, Name %>" 
                SortExpression="TypeName" />
        </Columns>
        <FooterStyle BackColor="#CCCCCC" />
        <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="#CCCCCC" />
    </asp:GridView>
    <asp:LinqDataSource ID="CompEnrolmentTypeLinqDataSource" runat="server" 
        ContextTypeName="SVAccountingBL.SVALinqDataContext" EnableDelete="True" 
        EnableInsert="True" EnableUpdate="True" TableName="CompEnrolmentTypes" 
        ondeleted="LinqDataSource_Deleted" 
        onupdated="LinqDataSource_Updated" 
        oninserted="LinqDataSource_Inserted" 
        >
    </asp:LinqDataSource>
    
    
    <asp:UpdatePanel ID="AddNewPanel" runat="server">
   <ContentTemplate>
    <br />
    <asp:LinkButton ID="lbtnAddNew" runat="server" 
                    Text="<%$ Resources:Resource, AddNew %>" 
           onclick="AddNew_Click"/>
    <br />
    <br />
    <div ID="InsertDiv" runat="server" visible="false">
       <asp:DetailsView ID="dvInsertCompEnrollmentType" runat="server" Height="50px" 
           Width="125px" AutoGenerateRows="False" CellPadding="4" DataKeyNames="TypeCode" 
           DataSourceID="CompEnrolmentTypeLinqDataSource" DefaultMode="Insert" 
           ForeColor="#333333" GridLines="None" onitemcommand="InsertDV_ItemCommand">
           <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
           <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
           <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
           <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
           <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
           <Fields>
               <asp:TemplateField HeaderText="<%$ Resources:Resource, Code %>" SortExpression="TypeCode">
                   <EditItemTemplate>
                       <asp:Label ID="Label1" runat="server" Text='<%# Eval("TypeCode") %>'></asp:Label>
                   </EditItemTemplate>
                   <InsertItemTemplate>
                   <table>
                    <tr>
                        <td>
                            <asp:TextBox ID="txtTypeCode" runat="server" Text='<%# Bind("TypeCode") %>'></asp:TextBox>
                        </td>
                        <td>
                            <asp:RequiredFieldValidator ID="rfvTypeCode" runat="server" ErrorMessage="*" ControlToValidate="txtTypeCode" EnableClientScript="true" />
                        </td>
                    </tr>
                   </table>
                   </InsertItemTemplate>
                   <ItemTemplate>
                       <asp:Label ID="Label2" runat="server" Text='<%# Bind("TypeCode") %>'></asp:Label>
                   </ItemTemplate>
               </asp:TemplateField>
               <asp:TemplateField HeaderText="<%$ Resources:Resource, Name %>" SortExpression="TypeName">
                   <EditItemTemplate>
                       <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("TypeName") %>'></asp:TextBox>
                   </EditItemTemplate>
                   <InsertItemTemplate>
                   <table>
                    <tr>
                        <td>
                            <asp:TextBox ID="txtTypeName" runat="server" Text='<%# Bind("TypeName") %>'></asp:TextBox>
                        </td>
                        <td>
                            <asp:RequiredFieldValidator ID="rfvTypeName" runat="server" ErrorMessage="*" ControlToValidate="txtTypeName" EnableClientScript="true" />
                        </td>
                    </tr>
                   </table>
                   </InsertItemTemplate>
                   <ItemTemplate>
                       <asp:Label ID="Label1" runat="server" Text='<%# Bind("TypeName") %>'></asp:Label>
                   </ItemTemplate>
               </asp:TemplateField>
               <asp:CommandField ButtonType="Image" CancelImageUrl="~/Icons/Cancel.png" 
                   InsertImageUrl="~/Icons/Add.png" ShowInsertButton="True" />
           </Fields>
           <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
           <EditRowStyle BackColor="#999999" />
           <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
       </asp:DetailsView>
    </div>
    </ContentTemplate>
    
    <Triggers>
         <asp:AsyncPostBackTrigger ControlID="lbtnAddNew" EventName="click" />
         <asp:PostBackTrigger ControlID="dvInsertCompEnrollmentType" /> 
    </Triggers>
   </asp:UpdatePanel>
    
    
    
</asp:Content>